﻿using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

using HGZP.PLL;

namespace Admin
{
    public class Tip_Web
    {
        static public void Tip()
        {

            Public.globalErrorString = GetValidInfo(Public.globalErrorString);
            string sMessage = "<script language=javascript>window.alert('{0}');</script>";
            sMessage = string.Format(sMessage, Public.globalErrorString);
            HttpContext.Current.Response.Write(sMessage); //显示提示框

        }
        static public void Tip(Label showError)
        {

            Public.globalErrorString = GetValidInfo(Public.globalErrorString);
            showError.Text = Public.globalErrorString;

        }
        //

        static public void UpdatePanel_Tip(UpdatePanel myUpdatePanel, string myAlert)
        {
            myAlert = GetValidInfo(myAlert);
            string sMessage = "alert('{0}')";
            sMessage = string.Format(sMessage, myAlert);
            ScriptManager.RegisterStartupScript(myUpdatePanel, HttpContext.Current.GetType(), "updateScript", sMessage, true);
        }
        //
        static public string GetValidInfo(string myInfo)
        {
            string validInfo = myInfo.Replace("\n", string.Empty)
                                     .Replace("\r", string.Empty)
                                     .Replace("'", string.Empty)
                                     .Replace("\"", string.Empty)
                                    ;

            return validInfo;
        }
    }
}
